var app = angular.module('fiveApp.filters' , []);


//返回距离当前时间多少天
app.filter('timeToDayNum' , function(){
	return function(time , str){
		str = str || '天';
		var nowTime = new Date().getTime() / 1000;
		if(nowTime < time){
			return -1;
		}
		if(nowTime - time < 3600 * 24)
			return '今天';
		var day = Math.ceil((nowTime - time) / 3600 / 24);
		return day >= 100 ? '99+' : day+str;
	}
})

app.filter('trueHtml' , ['$sce' , function($sce){
	return function(string){
		return $sce.trustAsHtml(string);
	}
}])
app.filter('trueUrl' , ['$sce' , function($sce){
	return function(url){
		return $sce.trustAsResourceUrl(url);
	}
}])